<?php

/**
 * Articles form base class.
 *
 * @method Articles getObject() Returns the current form's model object
 *
 * @package    bignewsarticles
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseArticlesForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                 => new sfWidgetFormInputHidden(),
      'title'              => new sfWidgetFormInputText(),
      'abstract'           => new sfWidgetFormInputText(),
      'text'               => new sfWidgetFormTextarea(),
      'keyword'            => new sfWidgetFormInputText(),
      'status'             => new sfWidgetFormChoice(array('choices' => array(1 => '1', 2 => '2', 3 => '3', 4 => '4', 5 => '5'))),
      'is_hote'            => new sfWidgetFormInputText(),
      'is_featured'        => new sfWidgetFormInputText(),
      'is_aow'             => new sfWidgetFormInputText(),
      'views'              => new sfWidgetFormInputText(),
      'category_id'        => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Category'), 'add_empty' => false)),
      'user_id'            => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Users'), 'add_empty' => false)),
      'number_of_comments' => new sfWidgetFormInputText(),
      'created_at'         => new sfWidgetFormDateTime(),
      'updated_at'         => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'                 => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'title'              => new sfValidatorString(array('max_length' => 255)),
      'abstract'           => new sfValidatorString(array('max_length' => 255)),
      'text'               => new sfValidatorString(),
      'keyword'            => new sfValidatorString(array('max_length' => 255)),
      'status'             => new sfValidatorChoice(array('choices' => array(0 => '1', 1 => '2', 2 => '3', 3 => '4', 4 => '5'))),
      'is_hote'            => new sfValidatorInteger(),
      'is_featured'        => new sfValidatorInteger(),
      'is_aow'             => new sfValidatorInteger(),
      'views'              => new sfValidatorInteger(),
      'category_id'        => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Category'))),
      'user_id'            => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Users'))),
      'number_of_comments' => new sfValidatorInteger(),
      'created_at'         => new sfValidatorDateTime(),
      'updated_at'         => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('articles[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Articles';
  }

}
